package com.snail.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.snail.model.dto.*;
import com.snail.model.pojo.SysTeam;
import com.baomidou.mybatisplus.extension.service.IService;
import com.snail.model.vo.SysTeamPageListVo;
import com.snail.response.BaseResponse;
import com.snail.response.PageResponse;

import java.util.List;

/**
 * @author Monica
 * @description 针对表【sys_team(战队信息表)】的数据库操作Service
 * @createDate 2025-07-23 14:30:24
 */
public interface SysTeamService extends IService<SysTeam> {

    /**
     * 查询自己创建的战队信息
     */
    List<SysTeam> findCreateTeam(Long userId);

    /**
     * 查询自己是队长的战队信息
     */
    List<SysTeam> selectMyTeams(Long userId);

    /**
     * 查询自己加入的战队信息通过userId
     */
    List<SysTeam> selectJoinedTeams(Long userId);


    /**
     * 查询自己所订阅的全部战队信息
     */
    List<SysTeam> selectSubscribeTeams(Long userId);

    /**
     * 查询战队详情
     */
    TeamDetailsDTO getTeamDetails(Long teamId);

    /**
     * 查询战队成员信息
     */
    List<TeamMembersDTO> selectTeamMembers(Long teamId);

    /**
     * 订阅战队的请求
     */
    boolean createSubscription(Long userId, Long teamId, SubscriptionRequestDTO subscriptionRequestDTO);

    /**
     * 取消订阅战队的请求
     */
    boolean deleteSubscription(Long userId, Long teamId);

    /**
     * 退出战队(如果是队长退出，则自动让给最早加入的战队，如果没有成员则直接解散战队)
     */
    boolean quitTeam(Long userId, Long teamId);

    /**
     * 转让战队的队长
     */
    boolean transferTeamLeader(Long teamId, Long userId, Long newLeaderId);

    /**
     * 修改队伍信息
     */
    boolean updateTeamDetails(Long teamId, TeamDetailsDTO teamDetailsDTO, Long userId);

    /**
     * 移除战队成员
     */
    boolean removeTeamMember(Long teamId, Long memberId);

    PageResponse<SysTeam> getTeamList(SysTeamPageListVo sysTeamPageListVo);

    BaseResponse<SysTeam> createTeam(SysTeam sysTeam);

    /**
     * 审核战队成员
     */
    boolean reviewMember(Long teamId, Long memberId, Integer status, Long userId);

    /**
     * 获取审核成员列表
     */
    List<TeamMembersDTO> getReviewMembers(Long teamId, Long userId);


    List<SysTeam> selectMyAllTeams(Long userId);

    /**
     * 获取战队列表带有队长信息
     */
    PageResponse<SysTeamWithCaptainDTO> getTeamListWithCaptain(SysTeamPageListVo vo);

    /**
     * 获取战队列表带有队员信息
     */
    Page<TeamWithMemberCountDTO> getTeamListWithRealMemberCount(TeamQueryDTO queryDTO);
}
